<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>搜索分析- 跳转分析</title>
<meta name="description" content="overview &amp; stats" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet"  href="${request.contextPath}/assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="${request.contextPath}/assets/font-awesome/4.2.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="${request.contextPath}/assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet" href="${request.contextPath}/assets/css/jquery.gritter.min.css" />
<link rel="stylesheet" href="${request.contextPath}/assets/fonts/fonts.googleapis.com.css" />
<link rel="stylesheet" href="${request.contextPath}/assets/css/bootstrapValidator.min.css" />
<link rel="stylesheet" href="${request.contextPath}/assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />
<link rel="stylesheet" href="${request.contextPath}/assets/css/bsie-paginator.css" />
<link rel="stylesheet"  href="${request.contextPath}/stylesheets/daterangepicker.css">
<link rel="stylesheet" href="${request.contextPath}/stylesheets/tips.css"/>
</head>
<style>
 tr,th{text-align: center;}
 a:hover{color:blue;text-decoration: none;}
.stat.stat-important:after {bottom: -27px !important;}
</style>
<body class="no-skin" style="background-color: #FFF;">
	<div class="page-content">
		<div class="tabbable">
			<ul class="nav nav-tabs" id="myTab">
				<li class="active"><a data-toggle="tab" href="#"  aria-expanded="false" onclick="changeTab(1)">默认标签 跳转分析</a></li>
				<li class=""><a data-toggle="tab" href="#"  aria-expanded="true"  onclick="changeTab(2)">切换标签 跳转分析</a></li>
			</ul>
			
			<div class="tab-content" id="skipDiv1" >
				<div id="manage" class="tab-pane active in">
					<div class="row">
						<div class="col-xs-12">
						<!-- 筛选条件开始 -->
							<div class="row">
								<div class="col-xs-12">
									<div class="widget-box">
										<div class="widget-header widget-header-small">
											<h4 class="widget-title">默认标签 跳转分析</h4>
										</div>
										<div class="widget-body" style="background-color: #EFF3F8;">
											<div class="widget-main">
												<form class="form-inline" id="searchForm" method="post" action="#">
													<div class="form-group">
														<label for="exampleInputName2">选择时段
															<input type="text" id="config-demo" name="chooseTime"  class="form-control time">
															<button id="app_search" type="button"  onclick="replaceDate(this,'1');" class="btn btn-white btn-sm">
																<span class="ace-icon icon-on-right bigger-110"></span>
																昨日
															</button>
															<button id="app_search" type="button"  onclick="replaceDate(this,'7');" class="btn btn-white btn-sm">
																<span class="ace-icon icon-on-right bigger-110"></span>
																过去7天
															</button>
															<button id="app_search" type="button"  onclick="replaceDate(this,'31');" class="btn btn-white btn-sm">
																<span class="ace-icon icon-on-right bigger-110"></span>
																过去31天
															</button>
														</label>
														<label for="exampleInputName" style="margin-left: 30px;">分站：
															<select class="chosen-select" tabindex="2"  name="station_id" id="station_id" style="width:80px;">
																 <option value="0">全部</option>
																 <#if stationList?? && stationList?size&gt;0>
																	 <#list stationList as item>
																		<option value="${item.stationId}" <#if item.stationName == '上海'>selected</#if> >${item.stationName}</option>
																	 </#list>
																 </#if>
															</select>
														</label>
														
														<label for="exampleInputName" style="margin-left: 30px;">平台：
															<select class="chosen-select" tabindex="2" name="platform_code" id="platform_code" style="width:80px;">
																<option value="">全部</option>
																<!-- <option value="pc">PC</option> -->
																<option value="app">APP</option>
																<option value="wap">WAP</option>
															</select>
														</label>
														
														<label for="exampleInputName" style="margin-left: 30px;">访问类型:</label>
														<div class="btn-group">
															<label class="btn btn-sm btn-link"> 
															<input type="radio" name="amount_type"  checked value="uv"> UV
												           </label>
												           <label class="btn btn-sm btn-link"> 
															<input type="radio" name="amount_type" value="pv"> PV
															</label>
												         </div>
														
														<button id="search" type="button" class="btn btn-pink btn-sm"  style="margin-left: 50px;">
															<span class="ace-icon fa fa-search icon-on-right bigger-110"></span> Search
														</button>
													</div>
												</form>
											</div>
										</div>
									</div>
								</div>
							</div>
							<!-- 筛选条件结束 -->
							<div class="row">
								<div class="col-xs-6">
									<div class="widget-box">
										<div class="widget-header widget-header-flat">
											<h4 class="widget-title lighter">
												<i class="ace-icon fa fa-star orange"></i>跳转默认标签品类统计
											</h4>
											<span style="font-size: 10px;">(视图可点击！！)</span>
											<label class="help_img">
												<i class="blue ace-icon fa fa-question-circle bigger-120" style="color:#999999!important;"></i>
												<span class='tips'>一段时间内搜索进入默认品类（即搜索首次进入的品类）的成功跳转总次数<s></s></span>
											</label>
										</div>
										<div class="widget-header widget-header-small">
											<div id="statistical-chart"  style="height: 400px;"></div>
										</div>
									</div>
								</div>
								<div class="col-xs-6" style="padding-left: 0px!important;">
									<div class="widget-box">
										<div class="widget-header widget-header-flat">
											<h4 class="widget-title lighter">
												<i class="ace-icon fa fa-signal  blue"></i>跳转默认品类趋式
											</h4>
											<label class="help_img">
												<i class="blue ace-icon fa fa-question-circle bigger-120" style="color:#999999!important;"></i>
												<span class='tips'>一段时间内搜索进入默认品类（即搜索首次进入的品类）的逐日成功跳转次数<s></s></span>
											</label>
										</div>
										<div class="widget-header widget-header-small">
											<div id="tendency-chart" style="height: 400px;"></div>
										</div>
									</div>
								</div>
							</div>
							
							<div class="row" id="chartByClick" style="display: none;">
							   <div class="col-xs-6" >
									<div class="widget-box transparent">
										<div class="widget-body">
											<div class="widget-main no-padding">
												<div class="widget-header widget-header-flat">
													<h4 class="widget-title lighter">
														<i class="ace-icon fa fa-star orange"></i><span class="categoryName"></span>
														<label style="margin-left: 20px;" class="dateSection"></label>
														<label style="float:right;padding-right: 10px;font-weight: bold;font-size: 16px;" id="successRateM"></label>
													</h4>
													<label class="help_img">
														<i class="blue ace-icon fa fa-question-circle bigger-120" style="color:#999999!important;"></i>
														<span class='tips'>一段时间内某一默认跳转品类的转化率（直接跳转成功/跳转失败）<s></s></span>
													</label>
												</div>
												<div class="widget-header widget-header-small">
													<div id="detail-chart" style="height: 200px;"></div>
												</div>
											</div>
									   </div>
									</div>
							  </div>
							 </div>
						   </div>
						</div>
					</div>
				</div>
			</div>
		
<!-- /////////////////////////切换标签 跳转分析//////////////////////////////////////////////// -->
			<div class="tab-content"  id="skipDiv2" style="display: none;">
				<div id="manage" class="tab-pane active in">
					<div class="row">
						<div class="col-xs-12">
						<!-- 筛选条件开始 -->
							<div class="row">
								<div class="col-xs-12">
									<div class="widget-box">
										<div class="widget-header widget-header-small">
											<h4 class="widget-title">切换标签 跳转分析</h4>
										</div>
										<div class="widget-body" style="background-color: #EFF3F8;">
											<div class="widget-main">
												<form class="form-inline" id="searchForm2" method="post" action="#">
													<div class="form-group">
														<label for="exampleInputName2">选择时段
															<input type="text" id="config-demo2" name="chooseTime2"  class="form-control time">
															<button id="app_search" type="button"  onclick="replaceDate(this,'1');" class="btn btn-white btn-sm">
																<span class="ace-icon icon-on-right bigger-110"></span>
																昨日
															</button>
															<button id="app_search" type="button"  onclick="replaceDate(this,'7');" class="btn btn-white btn-sm">
																<span class="ace-icon icon-on-right bigger-110"></span>
																过去7天
															</button>
															<button id="app_search" type="button"  onclick="replaceDate(this,'31');" class="btn btn-white btn-sm">
																<span class="ace-icon icon-on-right bigger-110"></span>
																过去31天
															</button>
														</label>
														<label for="exampleInputName" style="margin-left: 30px;">分站：
															<select class="chosen-select" tabindex="2"  name="station_id2" id="station_id2" style="width:80px;">
																 <option value="0">全部</option>
																 <#if stationList?? && stationList?size&gt;0>
																	 <#list stationList as item>
																		<option value="${item.stationId}" <#if item.stationName == '上海'>selected</#if> >${item.stationName}</option>
																	 </#list>
																 </#if>
															</select>
														</label>
														
														<label for="exampleInputName" style="margin-left: 30px;">平台：
															<select class="chosen-select" tabindex="2" name="platform_code2" id="platform_code2" style="width:80px;">
																<option value="">全部</option>
																<!-- <option value="pc">PC</option> -->
																<option value="app">APP</option>
																<option value="wap">WAP</option>
															</select>
														</label>
														
														<label for="exampleInputName" style="margin-left: 30px;">访问类型:</label>
														<div class="btn-group">
															<label class="btn btn-sm btn-link"> 
																<input type="radio" name="amount_type2" checked value="uv"> UV
												            </label>
															<label class="btn btn-sm btn-link"> 
																<input type="radio" name="amount_type2"  value="pv"> PV
															</label>
															
												         </div>
														
														<button id="search2" type="button" class="btn btn-pink btn-sm"  style="margin-left: 50px;">
															<span class="ace-icon fa fa-search icon-on-right bigger-110"></span> Search
														</button>
													</div>
												</form>
											</div>
										</div>
									</div>
								</div>
							</div>
							<!-- 筛选条件结束 -->
							<div class="row">
								<div class="col-xs-6">
									<div class="widget-box">
										<div class="widget-header widget-header-flat">
											<h4 class="widget-title lighter">
												<i class="ace-icon fa fa-star orange"></i>切换跳转品类统计
											</h4>
											<span style="font-size: 10px;">(视图可点击！！)</span>
											<label class="help_img">
												<i class="blue ace-icon fa fa-question-circle bigger-120" style="color:#999999!important;"></i>
												<span class='tips'>一段时间内搜索进入默认品类（即搜索首次进入的品类）的成功跳转总次数<s></s></span>
											</label>
										</div>
										<div class="widget-header widget-header-small">
											<div id="statistical-chart2" style="height: 400px;"></div>
										</div>
									</div>
								</div>
								<div class="col-xs-6" style="padding-left: 0px!important;">
									<div class="widget-box">
										<div class="widget-header widget-header-flat">
											<h4 class="widget-title lighter">
												<i class="ace-icon fa fa-signal  blue"></i>切换跳转品类趋式
											</h4>
											<label class="help_img">
												<i class="blue ace-icon fa fa-question-circle bigger-120" style="color:#999999!important;"></i>
												<span class='tips'>一段时间内切换跳转品类（即切换搜索结果页品类的标签按钮跳转的品类）的逐日跳转成功次数<s></s></span>
											</label>
										</div>
										<div class="widget-header widget-header-small">
											<div id="tendency-chart2" style="height: 400px;"></div>
										</div>
									</div>
								</div>
							</div>
							  <div class="row" id="tableByClick"  style="display: none;">
								<div class="col-xs-6">
									<div class="widget-box transparent">
										<div class="widget-body">
											<div class="widget-main no-padding">
												<div class="widget-header widget-header-flat">
													<h4 class="widget-title lighter">
														<i class="ace-icon fa fa-star orange"></i>品类：<span class="categoryName"></span>
													</h4>
													<label class="help_img">
														<i class="blue ace-icon fa fa-question-circle bigger-120" style="color:#999999!important;"></i>
														<span class='tips'>一段时间内某个品类搜索成功跳转的关键词的搜索次数<s></s></span>
													</label>
												</div>
												<table class="table table-bordered table-striped">
													<thead class="thin-border-bottom">
														<tr>
															<th>
																 <i class="ace-icon fa fa-caret-right blue"></i>序号 
															 </th>
															<th> <i class="ace-icon fa fa-caret-right blue"></i>关键词</th>
															<th class="hidden-480"><i class="ace-icon fa fa-caret-right blue"></i>切换跳转成功次数</th>
														</tr>
													</thead>
													<tbody class="pointTab"> </tbody>
												</table>
												
												<div class="ui-jqgrid">
													<div id="grid-pager"
														class="ui-state-default ui-jqgrid-pager ui-corner-bottom"
														dir="ltr">
														<div id="pg_grid-pager" class="ui-pager-control" role="group">
															<input type="text" id="currentPage" hidden="true" value=1>
															<input type="text" id="page_size" value =10 hidden="true">
															<input type="text" id="page_total" hidden="true">
															<table cellspacing="0" cellpadding="0" border="0"
																class="ui-pg-table"
																style="width: 100%; table-layout: fixed; height: 100%;"
																role="row">
																<tbody>
																	<tr>
																		<td id="grid-pager_left" align="left"></td>
																		<td id="grid-pager_center" align="center"
																			style="white-space: pre; width: 343px;"><table
																				cellspacing="0" cellpadding="0" border="0"
																				style="table-layout: auto;" class="ui-pg-table">
																				<tbody>
																					<tr>
																						<td id="first_grid-pager"
																							onclick="showPage('firstPage')"
																							class="ui-pg-button ui-corner-all "
																							style="cursor: pointer;"><span
																							class="ui-icon ace-icon fa fa-angle-double-left bigger-140"></span></td>
																						<td id="prev_grid-pager"
																							onclick="showPage('prePage')"
																							class="ui-pg-button ui-corner-all "
																							style="cursor: pointer;"><span
																							class="ui-icon ace-icon fa fa-angle-left bigger-140"></span></td>
																						<td dir="ltr">Page <input class="ui-pg-input" id="page_num"
																							type="text" size="2" maxlength="7" disabled="true" 
																							value="" role="textbox"> of <span
																							id="sp_1_grid-pager"></span></td>
																						<td id="next_grid-pager"
																							onclick="showPage('nextPage')"
																							class="ui-pg-button ui-corner-all "
																							style="cursor: pointer;"><span
																							class="ui-icon ace-icon fa fa-angle-right bigger-140"></span></td>
																						<td id="last_grid-pager"
																							onclick="showPage('lastPage')"
																							class="ui-pg-button ui-corner-all "
																							style="cursor: pointer;"><span
																							class="ui-icon ace-icon fa fa-angle-double-right bigger-140"></span></td>
																					</tr>
																				</tbody>
																			</table></td>
																			
																		<td id="grid-pager_right" align="right">
																				<div dir="ltr" style="text-align: right" class="ui-paging-info">View
																					<span id="view_start_row"></span> - <span id="view_end_row"></span> 
																					of <span id="view_page_total"></span>
																				</div>
																		</td>
																	</tr>
																</tbody>
															</table>
														</div>
													</div>
												</div>
												
											</div>
										</div>
									</div>
								</div>
								
								<div class="col-xs-6" id="chartByClick2" style="padding-left: 0px!important;">
									<div class="widget-box transparent">
										<div class="widget-body">
											<div class="widget-main no-padding">
												<div class="widget-header widget-header-flat">
													<h4 class="widget-title lighter">
														<i class="ace-icon fa fa-star orange"></i><span class="categoryName"></span>
														<label style="margin-left: 20px;" class="dateSection"></label>
														<label style="float:right;padding-right: 10px;font-weight: bold;font-size: 16px;" id="successRate"></label>
													</h4>
													<label class="help_img">
														<i class="blue ace-icon fa fa-question-circle bigger-120" style="color:#999999!important;"></i>
														<span class='tips'>一段时间内某一切换跳转品类的转化率（切换跳转成功/跳转失败）<s></s></span>
													</label>
												</div>
												<div class="widget-header widget-header-small">
													<div id="detail-chart2" style="height: 200px;"></div>
												</div>
											</div>
									   </div>
									</div>
							  </div>
								
						   </div>
							  
						   </div>
						</div>
					</div>
				</div>
			</div>
	<script src="${request.contextPath}/assets/js/jquery.2.1.1.min.js"></script>
	<script src="${request.contextPath}/assets/js/bootstrap.min.js"></script>
	<script src="${request.contextPath}/assets/js/jquery-ui.custom.min.js"></script>
	<script src="${request.contextPath}/assets/js/jquery.ui.touch-punch.min.js"></script>
	<script src="${request.contextPath}/assets/js/bootbox.min.js"></script>
	<script src="${request.contextPath}/assets/js/jquery.gritter.min.js"></script>
	<script src="${request.contextPath}/assets/js/spin.min.js"></script>
	<script src="${request.contextPath}/assets/js/ace-elements.min.js"></script>
	<script src="${request.contextPath}/assets/js/ace.min.js"></script>
	<script src="${request.contextPath}/assets/js/bootstrapValidator.min.js"></script>
	<script src="${request.contextPath}/assets/js/user/base.js"></script>
	<script src="${request.contextPath}/assets/js/ace-extra.min.js"></script>
	<script src="${request.contextPath}/assets/js/moment.min.js"></script>
	<script
		src="${request.contextPath}/assets/js/bootstrap-datetimepicker.min.js"></script>
	<script type="text/javascript"
		src="${request.contextPath}/javascripts/jquery.2.1.1.min.js"></script>
	<script type="text/javascript"
		src="${request.contextPath}/javascripts/bootstrap.min.js"></script>
	<script type="text/javascript"
		src="${request.contextPath}/javascripts/moment.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/daterangepicker.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/dateRange.js"></script>
	<script src="${request.contextPath}/assets/js/d3.v3.min.js"></script>
	
	<script type="text/javascript" src="${request.contextPath}/javascripts/g2.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/g2-modal.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/slider.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/FileSaver.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/export-csv.js"></script>
	<script type="text/javascript">
	d3.select(self.frameElement).style("height", "1300px");
	$(document).ready(function(){
	 	$("#search").click();
	});
	
	$("#search").on("click",function(){
		var platform_code = $("#platform_code").val();
		var choose_date = $("#config-demo").val();
		var station_id =  $("#station_id").val();
		var flow_type = $("input[name='amount_type']:checked").val();
		getSearchData("默认标签",platform_code,choose_date,station_id,flow_type);
	});
	
	$("#search2").on("click",function(){
		var platform_code = $("#platform_code2").val();
		var choose_date = $("#config-demo2").val();
		var station_id =  $("#station_id2").val();
		var flow_type = $("input[name='amount_type2']:checked").val();
		getSearchData("切换标签",platform_code,choose_date,station_id,flow_type);
	});
	
	function getSearchData(key_type,platform_code,choose_date,station_id,flow_type){
		var beginAmount = 0;
		$.ajax({
			url : '${request.contextPath}/searchStatistic/jumpAjaxData',
			type : "POST",
			data : {
				flowType:flow_type,
				// choose_date:choose_date,
                beginDate:choose_date.split("-")[0]+" 00:00:00",
                endDate:choose_date.split("-")[1]+" 23:59:59",
				platformCode:platform_code,
				stationId:station_id,
				keyType:key_type
			},
			beforeSend: function(){
 			   $("#search").attr("disabled",true);
	    	 },
		    complete: function(){
		    	$("#search").attr("disabled",false);
		    },
			success:function(data) {
			    if(data.code!=0){
			        return;
				}
			    var data = data.data
				yData2 = {'PV量':data.amountList};
				yData1 = data.amountMap;
				
				xData1 = data.dateList;
				xData2 = data.categoryList;
				legend = data.categoryList;
				var defs = {
						'category': {
							alias : '品类'
						},
						'amount': {
							alias :'次数（次）'
						},
						'time':{
							type: 'time',
							tickCount: 8
						}
					}; 
				if("默认标签" == key_type){
		  			var chart = histogramModal(data.barData,'statistical-chart','category','amount','品类','次数（次）','400',defs);
				    if(data.barData != "" && data.barData != null){
				      chart.on('plotclick',function(ev){
						  var data = ev.data;
						  if (data) {
						    var name = data._origin['category'];
						    var amount = data._origin['amount'];
						    forwardWay(name,amount,key_type);
						  }
						});
						$("#statistical-chart").css("cursor","pointer");
						 var dataFirst = chart.getAllGeoms()[0].getData()[0];
						 $("#chartByClick").show();
						 forwardWay(dataFirst._origin['category'],dataFirst._origin['amount'],key_type);
				    }else{
				    	$("#chartByClick").hide();
				    }
				    
				    lineChartModal(data.lineData,'tendency-chart','time','amount','category','','次数（次）','400',defs);
				}else{
				   	var chart2 = histogramModal(data.barData,'statistical-chart2','category','amount','品类','次数（次）','400',defs);
				    if(data.barData != "" && data.barData != null){
				      chart2.on('plotclick',function(ev){
						  var data = ev.data;
						  if (data) {
						    var name = data._origin['category'];
						    var amount = data._origin['amount'];
						    forwardWay(name,amount,key_type);
						  }
						});
						$("#statistical-chart2").css("cursor","pointer");
						var dataFirst = chart2.getAllGeoms()[0].getData()[0];
						$("#chartByClick2").show();
				   		$("#tableByClick").show();
					    forwardWay(dataFirst._origin['category'],dataFirst._origin['amount'],key_type);
				    }else{
				    	$("#chartByClick2").hide();
				   		$("#tableByClick").hide();
				    }
				    lineChartModal(data.lineData,'tendency-chart2','time','amount','category','','次数（次）','400',defs);
				}
			},
			error:function(data) {
				showMsg("查询数据有误");
			}
		});
	}
	
	function forwardWay(category_name ,value,key_type){
		var page_size=$("#page_size").val();
		getDataByCategory(category_name ,value,key_type,1,page_size);
	}
	var labelTransferRate=new Object();
	function getDataByCategory(category_name ,value,key_type,currentPage,page_size){
		labelTransferRate.name=category_name;
		labelTransferRate.type=key_type;
		var choose_date = $("#config-demo").val();
		var platform_code = $("#platform_code").val();
		var station_id =  $("#station_id").val();
		var flow_type = $("input[name='amount_type']:checked").val();
		if(key_type == "切换标签"){
			platform_code = $("#platform_code2").val();
			choose_date = $("#config-demo2").val();
			station_id =  $("#station_id2").val();
			flow_type = $("input[name='amount_type2']:checked").val();
		}
		$(".categoryName").html(category_name);	
		$(".dateSection").html(choose_date);		
		$.ajax({
			url : '${request.contextPath}/searchStatistic/jumpByCategoryAjaxData',
			type : "POST",
			data : {
				flowType:flow_type,
				// choose_date:choose_date,
                beginDate:choose_date.split("-")[0]+" 00:00:00",
                endDate:choose_date.split("-")[1]+" 23:59:59",
				platformCode:platform_code,
				stationId:station_id,
				categoryName :category_name,
				keyType:key_type,
				pageCurrentNum:currentPage,
				pageSize:page_size
			},
			success:function(data) {
                if(data && data.code!=0){
                    return;
                }
                var data = data.data
				labelTransferRate.data=data.barData;
				if("默认标签" == key_type){
					var success = data.successTotal;
				    var fail = data.failTotal;
				    if(value != ""&& value != null){
				    	 $("#successRateM").html("转化率" + parseFloat(success/(fail+success)*100).toFixed(2) +"%");
				    }
				    var defs={
				    	"category":{
				    		alias:"跳转状态"
				    	},
				    	"amount":{
				    		alias:"次数(次)"
				    	}
				    };
					horizontalHistogramModal(data.barData,'detail-chart','category','amount',200,defs);
				}else{
					 var page=data.page;
					 if(page.pages>1){
				    	$("#page_total").val(page.pages);
				    	$("#currentPage").val(page.pageNum);
				    	$("#page_num").val(page.pageNum);
				    	$("#sp_1_grid-pager")[0].innerText=page.pages;
				    	$("#view_start_row")[0].innerText= page.startRow;
				    	$("#view_end_row")[0].innerText= page.endRow;
				    	$("#view_page_total")[0].innerText= page.total;
				    	$(".ui-jqgrid").show();
				    }else{
				    	$(".ui-jqgrid").hide();
				    }
				    
					var success = data.switchSuccessTotal;
				    var fail = data.switchFailTotal;
				     if(value != ""&& value != null){
				    	  $("#successRate").html("转化率" + parseFloat(success/(fail+success)*100).toFixed(2) +"%");
				    }
				    var defs={
				    	"category":{
				    		alias:"跳转状态"
				    	},
				    	"amount":{
				    		alias:"次数(次)"
				    	}
				    };
					horizontalHistogramModal(data.barData,'detail-chart2','category','amount',200,defs);
				    getSwitchData(page.list);
				}
			},
			error:function(data) {
				showMsg("查询数据有误");
			}
		});
	}
	
	function getSwitchData(list){
		var tbody = "";
		if(list !=""){
			for(j=0;j<list.length;j++) {
			   var value = list[j] 
		       tbody +=  "<tr>"+
							"<td style='width:15%;'>"+ (j+1) +"</td>"+
							"<td style='white-space:normal; word-break:break-all;width:70%;'><small>"+ value.productName +"</small></td>"+
							"<td  style='width:15%;' class='hidden-480'>"+ value.productNum +"</td>"+
						"</tr>";  
			}
	   }else{
	   		var tbody='<tr><td colspan="12"><div class="alert alert-danger" style="margin-bottom: 0px;" role="alert">没有记录!</div></td></tr>';
	   }
	    $(".pointTab").html(tbody); 
	    $("#tableByClick").show();
	}
   function changeTab(id){
   		if(id == 1){
   			$("#skipDiv1").show();
   			$("#skipDiv2").hide();
   			var platform_code = $("#platform_code").val();
   			var choose_date = $("#config-demo").val();
			var station_id =  $("#station_id").val();
			var flow_type = $("input[name='amount_type']:checked").val();
			getSearchData("默认标签",platform_code,choose_date,station_id,flow_type);
   		}else{

   			$("#skipDiv2").show();
   			$("#skipDiv1").hide();
   			var platform_code = $("#platform_code2").val();
   			var choose_date = $("#config-demo2").val();
			var station_id =  $("#station_id2").val();
			var flow_type = $("input[name='amount_type2']:checked").val();
			getSearchData("切换标签",platform_code,choose_date,station_id,flow_type);
   		}
   }  
   
    function showPage(param) {
        var endrow = parseInt($("#sp_1_grid-pager")[0].innerText);
        var currentPage = parseInt($("#currentPage").val());
        var page_size = $("#page_size").val();
		var flag = 0;
		if('firstPage'==param) {
			currentPage =1;
		}
		else if('prePage'==param) {
			if(currentPage==1){
				currentPage ==1;
				flag = 1;
			}else{
				currentPage = currentPage-1;
			}
		}
		else if('nextPage'==param) {
			if(currentPage==endrow){
				currentPage = endrow;
				flag = 1;
			}else{
				currentPage = currentPage+1;
			}
		} else if('lastPage'==param) {
			currentPage = endrow; 
		}
		if(flag==0){
			var value = $("#numByCategory2").html();
			var category_name = $(".categoryName").html();	
			getDataByCategory(category_name ,value,'切换标签',currentPage,page_size)
		}
	}

	//导出图表
/*	
	
	//导出转化率
	function exportLabelTransferRate(type){
			if(labelTransferRate!=null){
				var exportData=labelTransferRate.data;
				var exportContent="\uFEFF跳转状态,点击量\n";
				for(var i=0;i<exportData.length;i++){
					exportContent += exportData[i].category+","+exportData[i].amount+"\n";
				} 
				var blob = new Blob([exportContent],{type: "text/plain;charset=utf-8"});
	        	saveAs(blob, labelTransferRate.type+"-"+labelTransferRate.name+"转化率.csv");
			}
	}*/
 </script>
</body>
</html>